home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK1.toast / Development Kits / Hardware / PC Card SDKs / PC Card Manager 3.0 / CIncludes / Devices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-05  |  27.6 KB  |  841 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Devices.h
  3.  
  4.      Contains:    Device Manager Interfaces.
  5.  
  6.      Version:    System 7.5 and 8
  7.  
  8.      DRI:        Larry Chiu
  9.  
  10.      Copyright:    © 1984-1996 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Warning:    *** APPLE INTERNAL USE ONLY ***
  14.                  This file may contain unreleased API's
  15.  
  16.      BuildInfo:    Built by:            SuperMario Build Daemon
  17.                  With Interfacer:    2.0d11   (PowerPC native)
  18.                  From:                Devices.i
  19.                      Revision:        82
  20.                      Dated:            3/5/96
  21.                      Last change by:    lch
  22.                      Last comment:    Move parameters in DeviceManagerGetDeviceData around per Pradeep
  23.  
  24.      Bugs:        Report bugs to Radar component “System Interfaces”, “Latest”
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. #ifndef __DEVICES__
  29. #define __DEVICES__
  30.  
  31. #ifndef __OSUTILS__
  32. #include <OSUtils.h>
  33. #endif
  34. #ifndef __FILES__
  35. #include <Files.h>
  36. #endif
  37. #ifndef __QUICKDRAW__
  38. #include <Quickdraw.h>
  39. #endif
  40. #ifndef __EVENTS__
  41. #include <Events.h>
  42. #endif
  43. #if FOR_SYSTEM7_ONLY
  44. #ifndef __DIALOGS__
  45. #include <Dialogs.h>
  46. #endif
  47. #endif
  48. #ifndef __KERNEL__
  49. #include <Kernel.h>
  50. #endif
  51. #ifndef __NAMEREGISTRY__
  52. #include <NameRegistry.h>
  53. #endif
  54. #ifndef __CODEFRAGMENTS__
  55. #include <CodeFragments.h>
  56. #endif
  57. #ifndef __DRIVERFAMILYMATCHING__
  58. #include <DriverFamilyMatching.h>
  59. #endif
  60. #ifndef __IOITERATOR__
  61. #include <IOIterator.h>
  62. #endif
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67.  
  68. #if PRAGMA_IMPORT_SUPPORTED
  69. #pragma import on
  70. #endif
  71.  
  72. #if PRAGMA_ALIGN_SUPPORTED
  73. #pragma options align=mac68k
  74. #endif
  75.  
  76. /* Values of the 'message' parameter to a Chooser device package */
  77.  
  78. enum {
  79.     chooserInitMsg                = 11,                            /* the user selected this device package */
  80.     newSelMsg                    = 12,                            /* the user made new device selections */
  81.     fillListMsg                    = 13,                            /* fill the device list with choices */
  82.     getSelMsg                    = 14,                            /* mark one or more choices as selected */
  83.     selectMsg                    = 15,                            /* the user made a selection */
  84.     deselectMsg                    = 16,                            /* the user canceled a selection */
  85.     terminateMsg                = 17,                            /* allows device package to clean up */
  86.     buttonMsg                    = 19                            /* the user selected a button */
  87. };
  88.  
  89. /* Values of the 'caller' parameter to a Chooser device package */
  90.  
  91. enum {
  92.     chooserID                    = 1
  93. };
  94.  
  95. /* Values of the 'message' parameter to a Control Panel 'cdev' */
  96.  
  97. enum {
  98.     initDev                        = 0,                            /*Time for cdev to initialize itself*/
  99.     hitDev                        = 1,                            /*Hit on one of my items*/
  100.     closeDev                    = 2,                            /*Close yourself*/
  101.     nulDev                        = 3,                            /*Null event*/
  102.     updateDev                    = 4,                            /*Update event*/
  103.     activDev                    = 5,                            /*Activate event*/
  104.     deactivDev                    = 6,                            /*Deactivate event*/
  105.     keyEvtDev                    = 7,                            /*Key down/auto key*/
  106.     macDev                        = 8,                            /*Decide whether or not to show up*/
  107.     undoDev                        = 9,
  108.     cutDev                        = 10,
  109.     copyDev                        = 11,
  110.     pasteDev                    = 12,
  111.     clearDev                    = 13,
  112.     cursorDev                    = 14
  113. };
  114.  
  115. /* Special values a Control Panel 'cdev' can return */
  116.  
  117. enum {
  118.     cdevGenErr                    = -1,                            /*General error; gray cdev w/o alert*/
  119.     cdevMemErr                    = 0,                            /*Memory shortfall; alert user please*/
  120.     cdevResErr                    = 1,                            /*Couldn't get a needed resource; alert*/
  121.     cdevUnset                    = 3                                /* cdevValue is initialized to this*/
  122. };
  123.  
  124. /* Values of the 'message' parameter to a Monitor 'mntr' */
  125.  
  126. enum {
  127.     initMsg                        = 1,                            /*initialization*/
  128.     okMsg                        = 2,                            /*user clicked OK button*/
  129.     cancelMsg                    = 3,                            /*user clicked Cancel button*/
  130.     hitMsg                        = 4,                            /*user clicked control in Options dialog*/
  131.     nulMsg                        = 5,                            /*periodic event*/
  132.     updateMsg                    = 6,                            /*update event*/
  133.     activateMsg                    = 7,                            /*not used*/
  134.     deactivateMsg                = 8,                            /*not used*/
  135.     keyEvtMsg                    = 9,                            /*keyboard event*/
  136.     superMsg                    = 10,                            /*show superuser controls*/
  137.     normalMsg                    = 11,                            /*show only normal controls*/
  138.     startupMsg                    = 12                            /*code has been loaded*/
  139. };
  140.  
  141. /* control codes for DeskAccessories */
  142.  
  143. enum {
  144.     goodbye                        = -1,                            /* heap being reinitialized */
  145.     killCode                    = 1,                            /* KillIO requested */
  146.     accEvent                    = 64,                            /* handle an event */
  147.     accRun                        = 65,                            /* time for periodic action */
  148.     accCursor                    = 66,                            /* change cursor shape */
  149.     accMenu                        = 67,                            /* handle menu item */
  150.     accUndo                        = 68,                            /* handle undo command */
  151.     accCut                        = 70,                            /* handle cut command */
  152.     accCopy                        = 71,                            /* handle copy command */
  153.     accPaste                    = 72,                            /* handle paste command */
  154.     accClear                    = 73                            /* handle clear command */
  155. };
  156.  
  157. /* Control/Status Call Codes */
  158.  
  159. enum {
  160.     drvStsCode                    = 8,                            /* status call code for drive status */
  161.     ejectCode                    = 7,                            /* control call eject code */
  162.     tgBuffCode                    = 8                                /* set tag buffer code */
  163. };
  164.  
  165. /* miscellaneous Device Manager constants */
  166.  
  167. enum {
  168.     ioInProgress                = 1,                            /* predefined value of ioResult while I/O is pending */
  169.     aRdCmd                        = 2,                            /* low byte of ioTrap for Read calls */
  170.     aWrCmd                        = 3,                            /* low byte of ioTrap for Write calls */
  171.     asyncTrpBit                    = 10,                            /* trap word modifier */
  172.     noQueueBit                    = 9                                /* trap word modifier */
  173. };
  174.  
  175. /* flags used in the driver header and device control entry */
  176.  
  177. enum {
  178.     dReadEnable                    = 0,                            /* set if driver responds to read requests */
  179.     dWritEnable                    = 1,                            /* set if driver responds to write requests */
  180.     dCtlEnable                    = 2,                            /* set if driver responds to control requests */
  181.     dStatEnable                    = 3,                            /* set if driver responds to status requests */
  182.     dNeedGoodBye                = 4,                            /* set if driver needs time for performing periodic tasks */
  183.     dNeedTime                    = 5,                            /* set if driver needs time for performing periodic tasks */
  184.     dNeedLock                    = 6,                            /* set if driver must be locked in memory as soon as it is opened */
  185.     dNeedLockMask                = 0x4000,                        /* set if driver must be locked in memory as soon as it is opened */
  186.     dNeedTimeMask                = 0x2000,                        /* set if driver needs time for performing periodic tasks */
  187.     dNeedGoodByeMask            = 0x1000,                        /* set if driver needs to be called before the application heap is initialized */
  188.     dStatEnableMask                = 0x0800,                        /* set if driver responds to status requests */
  189.     dCtlEnableMask                = 0x0400,                        /* set if driver responds to control requests */
  190.     dWritEnableMask                = 0x0200,                        /* set if driver responds to write requests */
  191.     dReadEnableMask                = 0x0100                        /* set if driver responds to read requests */
  192. };
  193.  
  194. /* run-time flags used in the device control entry */
  195.  
  196. enum {
  197.     dOpened                        = 5,                            /* driver is open */
  198.     dRAMBased                    = 6,                            /* dCtlDriver is a handle (1) or pointer (0) */
  199.     drvrActive                    = 7,                            /* driver is currently processing a request */
  200.     drvrActiveMask                = 0x0080,                        /* driver is currently processing a request */
  201.     dRAMBasedMask                = 0x0040,                        /* dCtlDriver is a handle (1) or pointer (0) */
  202.     dOpenedMask                    = 0x0020                        /* driver is open */
  203. };
  204.  
  205. struct DRVRHeader {
  206.     short                             drvrFlags;
  207.     short                             drvrDelay;
  208.     short                             drvrEMask;
  209.     short                             drvrMenu;
  210.     short                             drvrOpen;
  211.     short                             drvrPrime;
  212.     short                             drvrCtl;
  213.     short                             drvrStatus;
  214.     short                             drvrClose;
  215.     unsigned char                     drvrName[1];
  216. };
  217. typedef struct DRVRHeader DRVRHeader;
  218.  
  219. typedef DRVRHeader *DRVRHeaderPtr;
  220. typedef DRVRHeaderPtr *DRVRHeaderHandle;
  221. #if FOR_SYSTEM7_ONLY
  222. struct DCtlEntry {
  223.     Ptr                             dCtlDriver;
  224.     short                             dCtlFlags;
  225.     QHdr                             dCtlQHdr;
  226.     long                             dCtlPosition;
  227.     Handle                             dCtlStorage;
  228.     short                             dCtlRefNum;
  229.     long                             dCtlCurTicks;
  230.     WindowPtr                         dCtlWindow;
  231.     short                             dCtlDelay;
  232.     short                             dCtlEMask;
  233.     short                             dCtlMenu;
  234. };
  235. typedef struct DCtlEntry DCtlEntry;
  236.  
  237. #else
  238. struct DCtlEntry {
  239.     Ptr                             dCtlDriver;
  240.     short                             dCtlFlags;
  241.     QHdr                             dCtlQHdr;
  242.     long                             dCtlPosition;
  243.     Handle                             dCtlStorage;
  244.     short                             dCtlRefNum;
  245.     long                             dCtlCurTicks;
  246.     Ptr                             dCtlWindow;
  247.     short                             dCtlDelay;
  248.     short                             dCtlEMask;
  249.     short                             dCtlMenu;
  250. };
  251. typedef struct DCtlEntry DCtlEntry;
  252.  
  253. #endif
  254. typedef DCtlEntry *DCtlPtr;
  255. typedef DCtlPtr *DCtlHandle;
  256. #if FOR_SYSTEM7_ONLY
  257. struct AuxDCE {
  258.     Ptr                             dCtlDriver;
  259.     short                             dCtlFlags;
  260.     QHdr                             dCtlQHdr;
  261.     long                             dCtlPosition;
  262.     Handle                             dCtlStorage;
  263.     short                             dCtlRefNum;
  264.     long                             dCtlCurTicks;
  265.     GrafPtr                         dCtlWindow;
  266.     short                             dCtlDelay;
  267.     short                             dCtlEMask;
  268.     short                             dCtlMenu;
  269.     SInt8                             dCtlSlot;
  270.     SInt8                             dCtlSlotId;
  271.     long                             dCtlDevBase;
  272.     Ptr                             dCtlOwner;
  273.     SInt8                             dCtlExtDev;
  274.     SInt8                             fillByte;
  275.     UInt32                             dCtlNodeID;
  276. };
  277. typedef struct AuxDCE AuxDCE;
  278.  
  279. typedef AuxDCE *AuxDCEPtr;
  280. typedef AuxDCEPtr *AuxDCEHandle;
  281. #else
  282. struct AuxDCE {
  283.     Ptr                             dCtlDriver;
  284.     short                             dCtlFlags;
  285.     QHdr                             dCtlQHdr;
  286.     long                             dCtlPosition;
  287.     Handle                             dCtlStorage;
  288.     short                             dCtlRefNum;
  289.     long                             dCtlCurTicks;
  290.     Ptr                             dCtlWindow;
  291.     short                             dCtlDelay;
  292.     short                             dCtlEMask;
  293.     short                             dCtlMenu;
  294.     SInt8                             dCtlSlot;
  295.     SInt8                             dCtlSlotId;
  296.     long                             dCtlDevBase;
  297.     Ptr                             dCtlOwner;
  298.     SInt8                             dCtlExtDev;
  299.     SInt8                             fillByte;
  300.     UInt32                             dCtlNodeID;
  301. };
  302. typedef struct AuxDCE AuxDCE;
  303.  
  304. typedef AuxDCE *AuxDCEPtr;
  305. typedef AuxDCEPtr *AuxDCEHandle;
  306. #endif
  307. /*    The NDRV Driver IO Entry Point and Commands */
  308. typedef UInt16 UnitNumber;
  309. typedef UInt32 DriverOpenCount;
  310. typedef SInt16 DriverRefNum;
  311. typedef SInt16 DriverFlags;
  312. typedef UInt32 IOCommandCode;
  313.  
  314. enum {
  315.     kOpenCommand                = 0,
  316.     kCloseCommand                = 1,
  317.     kReadCommand                = 2,
  318.     kWriteCommand                = 3,
  319.     kControlCommand                = 4,
  320.     kStatusCommand                = 5,
  321.     kKillIOCommand                = 6,
  322.     kInitializeCommand            = 7,                            /* init driver and device*/
  323.     kFinalizeCommand            = 8,                            /* shutdown driver and device*/
  324.     kReplaceCommand                = 9,                            /* replace an old driver*/
  325.     kSupersededCommand            = 10                            /* prepare to be replaced by a new driver*/
  326. };
  327.  
  328. typedef struct OpaqueIOCommandID* IOCommandID;
  329. typedef UInt32 IOCommandKind;
  330.  
  331. enum {
  332.     kSynchronousIOCommandKind    = 0x00000001,
  333.     kAsynchronousIOCommandKind    = 0x00000002,
  334.     kImmediateIOCommandKind        = 0x00000004
  335. };
  336.  
  337. struct DriverInitInfo {
  338.     DriverRefNum                     refNum;
  339.     RegEntryRef                     deviceEntry;
  340. };
  341. typedef struct DriverInitInfo DriverInitInfo;
  342.  
  343. typedef DriverInitInfo *DriverInitInfoPtr;
  344. typedef DriverInitInfo DriverReplaceInfo;
  345. typedef DriverInitInfo *DriverReplaceInfoPtr;
  346. struct DriverFinalInfo {
  347.     DriverRefNum                     refNum;
  348.     RegEntryRef                     deviceEntry;
  349. };
  350. typedef struct DriverFinalInfo DriverFinalInfo;
  351.  
  352. typedef DriverFinalInfo *DriverFinalInfoPtr;
  353. typedef DriverFinalInfo DriverSupersededInfo;
  354. typedef DriverFinalInfo *DriverSupersededInfoPtr;
  355. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  356. /* Contents are command specific*/
  357. union IOCommandContents {
  358.     ParmBlkPtr                         pb;
  359.     DriverInitInfoPtr                 initialInfo;
  360.     DriverFinalInfoPtr                 finalInfo;
  361.     DriverReplaceInfoPtr             replaceInfo;
  362.     DriverSupersededInfoPtr         supersededInfo;
  363. };
  364. typedef union IOCommandContents IOCommandContents;
  365.  
  366. #else
  367. struct IOParam {
  368.     QElemPtr                         qLink;                        /*queue link in header*/
  369.     short                             qType;                        /*type byte for safety check*/
  370.     short                             ioTrap;                        /*FS: the Trap*/
  371.     Ptr                             ioCmdAddr;                    /*FS: address to dispatch to*/
  372.     ProcPtr                         ioCompletion;                /*completion routine addr (0 for synch calls)*/
  373.     OSErr                             ioResult;                    /*result code*/
  374.     StringPtr                         ioNamePtr;                    /*ptr to Vol:FileName string*/
  375.     short                             ioVRefNum;                    /*volume refnum (DrvNum for Eject and MountVol)*/
  376.     short                             ioRefNum;                    /*refNum for I/O operation*/
  377.     SInt8                             ioVersNum;                    /*version number*/
  378.     SInt8                             ioPermssn;                    /*Open: permissions (byte)*/
  379.     Ptr                             ioMisc;                        /*Rename: new name (GetEOF,SetEOF: logical end of file) (Open: optional ptr to buffer) (SetFileType: new type)*/
  380.     Ptr                             ioBuffer;                    /*data buffer Ptr*/
  381.     long                             ioReqCount;                    /*requested byte count; also = ioNewDirID*/
  382.     long                             ioActCount;                    /*actual byte count completed*/
  383.     short                             ioPosMode;                    /*initial file positioning*/
  384.     long                             ioPosOffset;                /*file position offset*/
  385. };
  386. typedef struct IOParam IOParam;
  387.  
  388. typedef IOParam *IOParamPtr;
  389. struct CntrlParam {
  390.     QElemPtr                         qLink;                        /*queue link in header*/
  391.     short                             qType;                        /*type byte for safety check*/
  392.     short                             ioTrap;                        /*FS: the Trap*/
  393.     Ptr                             ioCmdAddr;                    /*FS: address to dispatch to*/
  394.     ProcPtr                         ioCompletion;                /*completion routine addr (0 for synch calls)*/
  395.     OSErr                             ioResult;                    /*result code*/
  396.     StringPtr                         ioNamePtr;                    /*ptr to Vol:FileName string*/
  397.     short                             ioVRefNum;                    /*volume refnum (DrvNum for Eject and MountVol)*/
  398.     short                             ioCRefNum;                    /*refNum for I/O operation*/
  399.     short                             csCode;                        /*word for control status code*/
  400.     short                             csParam[11];                /*operation-defined parameters*/
  401. };
  402. typedef struct CntrlParam CntrlParam;
  403.  
  404. typedef CntrlParam *CntrlParamPtr;
  405. union ParamBlockRec {
  406.     IOParam                         ioParam;
  407.     CntrlParam                         cntrlParam;
  408. };
  409. typedef union ParamBlockRec ParamBlockRec;
  410.  
  411. typedef ParamBlockRec *ParmBlkPtr;
  412. union IOCommandContents {
  413.     ParmBlkPtr                         pb;
  414.     DriverInitInfoPtr                 initialInfo;
  415.     DriverFinalInfoPtr                 finalInfo;
  416.     DriverReplaceInfoPtr             replaceInfo;
  417.     DriverSupersededInfoPtr         supersededInfo;
  418. };
  419. typedef union IOCommandContents IOCommandContents;
  420.  
  421. #endif
  422. typedef OSErr (*DriverEntryPointPtr)(AddressSpaceID SpaceID, IOCommandID CommandID, IOCommandContents Contents, IOCommandCode Code, IOCommandKind Kind);
  423. /* Record to describe a file-based driver candidate */
  424. struct FileBasedDriverRecord {
  425.     FSSpec                             theSpec;                    /* file specification*/
  426.     DriverType                         theType;                    /* nameInfoStr + version number*/
  427.     Boolean                         compatibleProp;                /* true if matched using a compatible name*/
  428.     UInt8                             pad[3];                        /* alignment*/
  429. };
  430. typedef struct FileBasedDriverRecord FileBasedDriverRecord;
  431.  
  432. typedef FileBasedDriverRecord *FileBasedDriverRecordPtr;
  433. /* Driver Loader API */
  434. #define DECLARE_DRIVERDESCRIPTION(N_ADDITIONAL_SERVICES)\
  435.         struct {\
  436.             DriverDescription    fixed;\
  437.             DriverServiceInfo    additional_service[N_ADDITIONAL_SERVICES-1];\
  438.         };
  439.  
  440. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  441. extern SInt16 HigherDriverVersion(NumVersion *driverVersion1, NumVersion *driverVersion2);
  442.  
  443. extern OSErr VerifyFragmentAsDriver(CFragConnectionID fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  444.  
  445. extern OSErr GetDriverMemoryFragment(Ptr memAddr, long length, ConstStr63Param fragName, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  446.  
  447. extern OSErr GetDriverDiskFragment(FSSpecPtr fragmentSpec, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  448.  
  449. #if FOR_SYSTEM7_ONLY
  450. extern OSErr InstallDriverFromFragment(CFragConnectionID fragmentConnID, RegEntryID *device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  451.  
  452. extern OSErr InstallDriverFromFile(FSSpecPtr fragmentSpec, RegEntryID *device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  453.  
  454. extern OSErr InstallDriverFromMemory(Ptr memory, long length, ConstStr63Param fragName, RegEntryID *device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  455.  
  456. extern OSErr InstallDriverFromDisk(Ptr theDriverName, RegEntryID *theDevice, UnitNumber theBeginningUnit, UnitNumber theEndingUnit, DriverRefNum *theRefNum);
  457.  
  458. extern OSErr FindDriversForDevice(RegEntryID *device, FSSpec *fragmentSpec, DriverDescription *fileDriverDesc, Ptr *memAddr, long *length, StringPtr fragName, DriverDescription *memDriverDesc);
  459.  
  460. extern OSErr FindDriverCandidates(RegEntryID *deviceID, Ptr *propBasedDriver, RegPropertyValueSize *propBasedDriverSize, StringPtr deviceName, DriverType *propBasedDriverType, Boolean *gotPropBasedDriver, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount *nFileBasedDrivers);
  461.  
  462. extern OSErr ScanDriverCandidates(RegEntryID *deviceID, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount nFileBasedDrivers, FileBasedDriverRecordPtr matchingDrivers, ItemCount *nMatchingDrivers);
  463.  
  464. extern OSErr GetDriverForDevice(RegEntryID *device, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  465.  
  466. extern OSErr InstallDriverForDevice(RegEntryID *device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  467.  
  468. extern OSErr GetDriverInformation(DriverRefNum refNum, UnitNumber *unitNum, DriverFlags *flags, DriverOpenCount *count, StringPtr name, RegEntryID *device, CFragSystem7Locator *driverLoadLocation, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescription *driverDesc);
  469.  
  470. #else
  471. extern OSErr InstallDriverFromFragment(CFragConnectionID fragmentConnID, RegEntryRef *device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  472.  
  473. extern OSErr InstallDriverFromFile(FSSpecPtr fragmentSpec, RegEntryRef *device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  474.  
  475. extern OSErr InstallDriverFromMemory(Ptr memory, long length, ConstStr63Param fragName, RegEntryRef *device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  476.  
  477. extern OSErr InstallDriverFromDisk(Ptr theDriverName, RegEntryRef *theDevice, UnitNumber theBeginningUnit, UnitNumber theEndingUnit, DriverRefNum *theRefNum);
  478.  
  479. extern OSErr FindDriversForDevice(RegEntryRef *device, FSSpec *fragmentSpec, DriverDescription *fileDriverDesc, Ptr *memAddr, long *length, StringPtr fragName, DriverDescription *memDriverDesc);
  480.  
  481. extern OSErr FindDriverCandidates(RegEntryRef *deviceID, Ptr *propBasedDriver, UInt32 *propBasedDriverSize, StringPtr deviceName, DriverType *propBasedDriverType, Boolean *gotPropBasedDriver, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount *nFileBasedDrivers);
  482.  
  483. extern OSErr ScanDriverCandidates(RegEntryRef *deviceID, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount nFileBasedDrivers, FileBasedDriverRecordPtr matchingDrivers, ItemCount *nMatchingDrivers);
  484.  
  485. extern OSErr GetDriverForDevice(RegEntryRef *device, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  486.  
  487. extern OSErr InstallDriverForDevice(RegEntryRef *device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  488.  
  489. #endif
  490. extern OSErr SetDriverClosureMemory(CFragConnectionID fragmentConnID, Boolean holdDriverMemory);
  491.  
  492. extern OSErr ReplaceDriverWithFragment(DriverRefNum theRefNum, CFragConnectionID fragmentConnID);
  493.  
  494. extern OSErr OpenInstalledDriver(DriverRefNum refNum, SInt8 ioPermission);
  495.  
  496. extern OSErr RenameDriver(DriverRefNum refNum, StringPtr newDriverName);
  497.  
  498. extern OSErr RemoveDriver(DriverRefNum refNum, Boolean immediate);
  499.  
  500. extern OSErr LookupDrivers(UnitNumber beginningUnit, UnitNumber endingUnit, Boolean emptyUnits, ItemCount *returnedRefNums, DriverRefNum *refNums);
  501.  
  502. extern UnitNumber HighestUnitNumber(void );
  503.  
  504. extern OSErr DriverGestaltOn(DriverRefNum refNum);
  505.  
  506. extern OSErr DriverGestaltOff(DriverRefNum refNum);
  507.  
  508. extern Boolean DriverGestaltIsOn(DriverFlags flags);
  509.  
  510. #endif
  511. #if !OLDROUTINELOCATIONS
  512. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  513.  
  514. #if !GENERATINGCFM
  515. #pragma parameter __D0 PBOpenSync(__A0)
  516. #endif
  517. extern pascal OSErr PBOpenSync(ParmBlkPtr paramBlock)
  518.  ONEWORDINLINE(0xA000);
  519.  
  520.  
  521. #if !GENERATINGCFM
  522. #pragma parameter __D0 PBOpenAsync(__A0)
  523. #endif
  524. extern pascal OSErr PBOpenAsync(ParmBlkPtr paramBlock)
  525.  ONEWORDINLINE(0xA400);
  526.  
  527.  
  528. #if !GENERATINGCFM
  529. #pragma parameter __D0 PBOpenImmed(__A0)
  530. #endif
  531. extern pascal OSErr PBOpenImmed(ParmBlkPtr paramBlock)
  532.  ONEWORDINLINE(0xA200);
  533.  
  534.  
  535. #if !GENERATINGCFM
  536. #pragma parameter __D0 PBCloseSync(__A0)
  537. #endif
  538. extern pascal OSErr PBCloseSync(ParmBlkPtr paramBlock)
  539.  ONEWORDINLINE(0xA001);
  540.  
  541.  
  542. #if !GENERATINGCFM
  543. #pragma parameter __D0 PBCloseAsync(__A0)
  544. #endif
  545. extern pascal OSErr PBCloseAsync(ParmBlkPtr paramBlock)
  546.  ONEWORDINLINE(0xA401);
  547.  
  548.  
  549. #if !GENERATINGCFM
  550. #pragma parameter __D0 PBCloseImmed(__A0)
  551. #endif
  552. extern pascal OSErr PBCloseImmed(ParmBlkPtr paramBlock)
  553.  ONEWORDINLINE(0xA201);
  554.  
  555.  
  556. #if !GENERATINGCFM
  557. #pragma parameter __D0 PBReadSync(__A0)
  558. #endif
  559. extern pascal OSErr PBReadSync(ParmBlkPtr paramBlock)
  560.  ONEWORDINLINE(0xA002);
  561.  
  562.  
  563. #if !GENERATINGCFM
  564. #pragma parameter __D0 PBReadAsync(__A0)
  565. #endif
  566. extern pascal OSErr PBReadAsync(ParmBlkPtr paramBlock)
  567.  ONEWORDINLINE(0xA402);
  568.  
  569.  
  570. #if !GENERATINGCFM
  571. #pragma parameter __D0 PBReadImmed(__A0)
  572. #endif
  573. extern pascal OSErr PBReadImmed(ParmBlkPtr paramBlock)
  574.  ONEWORDINLINE(0xA202);
  575.  
  576.  
  577. #if !GENERATINGCFM
  578. #pragma parameter __D0 PBWriteSync(__A0)
  579. #endif
  580. extern pascal OSErr PBWriteSync(ParmBlkPtr paramBlock)
  581.  ONEWORDINLINE(0xA003);
  582.  
  583.  
  584. #if !GENERATINGCFM
  585. #pragma parameter __D0 PBWriteAsync(__A0)
  586. #endif
  587. extern pascal OSErr PBWriteAsync(ParmBlkPtr paramBlock)
  588.  ONEWORDINLINE(0xA403);
  589.  
  590.  
  591. #if !GENERATINGCFM
  592. #pragma parameter __D0 PBWriteImmed(__A0)
  593. #endif
  594. extern pascal OSErr PBWriteImmed(ParmBlkPtr paramBlock)
  595.  ONEWORDINLINE(0xA203);
  596.  
  597. extern pascal void AddDrive(short drvrRefNum, short drvNum, DrvQElPtr qEl);
  598.  
  599. #endif
  600. extern pascal QHdrPtr GetDrvQHdr(void )
  601.  THREEWORDINLINE(0x2EBC, 0x0000, 0x0308);
  602.  
  603. #endif
  604. /* Control Panel Default Proc */
  605. #if FOR_SYSTEM7_ONLY
  606. typedef pascal long (*ControlPanelDefProcPtr)(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog);
  607.  
  608. #if GENERATINGCFM
  609. typedef UniversalProcPtr ControlPanelDefUPP;
  610. #else
  611. typedef ControlPanelDefProcPtr ControlPanelDefUPP;
  612. #endif
  613.  
  614. enum {
  615.     uppControlPanelDefProcInfo = kPascalStackBased
  616.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  617.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  618.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  619.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  620.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short)))
  621.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(EventRecord *)))
  622.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(long)))
  623.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(DialogPtr)))
  624. };
  625.  
  626. #if GENERATINGCFM
  627. #define NewControlPanelDefProc(userRoutine)        \
  628.         (ControlPanelDefUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, GetCurrentArchitecture())
  629. #else
  630. #define NewControlPanelDefProc(userRoutine)        \
  631.         ((ControlPanelDefUPP) (userRoutine))
  632. #endif
  633.  
  634. #if GENERATINGCFM
  635. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)        \
  636.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppControlPanelDefProcInfo, (message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  637. #else
  638. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)        \
  639.         (*(userRoutine))((message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  640. #endif
  641. #endif
  642. extern pascal DCtlHandle GetDCtlEntry(short refNum);
  643.  
  644. /*
  645.     SetChooserAlert used to simply set a bit in a low-mem global
  646.     to tell the Chooser not to display its warning message when
  647.     the printer is changed. However, under MultiFinder and System 7,
  648.     this low-mem is swapped out when a layer change occurs, and the
  649.     Chooser never sees the change. It is obsolete, and completely
  650.     unsupported on the PowerPC. 68K apps can still call it if they
  651.     wish.
  652.     
  653. */
  654. #if OLDROUTINENAMES && !GENERATINGCFM
  655. extern pascal Boolean SetChooserAlert(Boolean f);
  656.  
  657. #endif
  658.  
  659. #if !GENERATINGCFM
  660. #pragma parameter __D0 DriverInstall(__A0, __D0)
  661. #endif
  662. extern pascal OSErr DriverInstall(DRVRHeaderPtr drvrPtr, short refNum)
  663.  ONEWORDINLINE(0xA03D);
  664.  
  665.  
  666. #if !GENERATINGCFM
  667. #pragma parameter __D0 DriverInstallReserveMem(__A0, __D0)
  668. #endif
  669. extern pascal OSErr DriverInstallReserveMem(DRVRHeaderPtr drvrPtr, short refNum)
  670.  ONEWORDINLINE(0xA43D);
  671.  
  672. /*
  673.   Note: DrvrInstall() is no longer supported, becuase it never really worked anyways.
  674.           There will soon be a DriverInstall() which does the right thing.
  675.  
  676.         DrvrRemove has been renamed to DriverRemove.  But, InterfaceLib for PowerPC
  677.         still exports DrvrRemove, so a macro is used to map the new name to old.
  678.  
  679. */
  680.  
  681. #if !GENERATINGCFM
  682. #pragma parameter __D0 DrvrRemove(__D0)
  683. #endif
  684. extern pascal OSErr DrvrRemove(short refNum)
  685.  ONEWORDINLINE(0xA03E);
  686.  
  687. #define DriverRemove(refNum) DrvrRemove(refNum)
  688. /*
  689.     Shim mechnanism only exist in Maxwell world.  A Shim is a translation layer
  690.     and looks like a DRVR. 
  691. */
  692. typedef pascal OSStatus (*ShimEntryPoint)(Ptr paramBlock, Ptr refcon);
  693. extern pascal OSStatus DriverInstallShim(DRVRHeaderPtr drvrPtr, ShimEntryPoint shim, short refNum, void *refcon);
  694.  
  695. extern pascal OSStatus DriverRemoveShim(short refNum);
  696.  
  697. extern pascal OSStatus DriverReturnShimRefcon(short refNum, void **refcon);
  698.  
  699. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  700. extern OSErr IOShimCommandIsComplete(ParmBlkPtr thePB, OSErr result);
  701.  
  702. #endif
  703. extern pascal OSErr OpenDriver(ConstStr255Param name, short *drvrRefNum);
  704.  
  705. extern pascal OSErr CloseDriver(short refNum);
  706.  
  707. extern pascal OSErr Control(short refNum, short csCode, const void *csParamPtr);
  708.  
  709. extern pascal OSErr Status(short refNum, short csCode, void *csParamPtr);
  710.  
  711. extern pascal OSErr KillIO(short refNum);
  712.  
  713. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  714.  
  715. #if !GENERATINGCFM
  716. #pragma parameter __D0 PBControlSync(__A0)
  717. #endif
  718. extern pascal OSErr PBControlSync(ParmBlkPtr paramBlock)
  719.  ONEWORDINLINE(0xA004);
  720.  
  721.  
  722. #if !GENERATINGCFM
  723. #pragma parameter __D0 PBControlAsync(__A0)
  724. #endif
  725. extern pascal OSErr PBControlAsync(ParmBlkPtr paramBlock)
  726.  ONEWORDINLINE(0xA404);
  727.  
  728.  
  729. #if !GENERATINGCFM
  730. #pragma parameter __D0 PBControlImmed(__A0)
  731. #endif
  732. extern pascal OSErr PBControlImmed(ParmBlkPtr paramBlock)
  733.  ONEWORDINLINE(0xA204);
  734.  
  735.  
  736. #if !GENERATINGCFM
  737. #pragma parameter __D0 PBStatusSync(__A0)
  738. #endif
  739. extern pascal OSErr PBStatusSync(ParmBlkPtr paramBlock)
  740.  ONEWORDINLINE(0xA005);
  741.  
  742.  
  743. #if !GENERATINGCFM
  744. #pragma parameter __D0 PBStatusAsync(__A0)
  745. #endif
  746. extern pascal OSErr PBStatusAsync(ParmBlkPtr paramBlock)
  747.  ONEWORDINLINE(0xA405);
  748.  
  749.  
  750. #if !GENERATINGCFM
  751. #pragma parameter __D0 PBStatusImmed(__A0)
  752. #endif
  753. extern pascal OSErr PBStatusImmed(ParmBlkPtr paramBlock)
  754.  ONEWORDINLINE(0xA205);
  755.  
  756.  
  757. #if !GENERATINGCFM
  758. #pragma parameter __D0 PBKillIOSync(__A0)
  759. #endif
  760. extern pascal OSErr PBKillIOSync(ParmBlkPtr paramBlock)
  761.  ONEWORDINLINE(0xA006);
  762.  
  763.  
  764. #if !GENERATINGCFM
  765. #pragma parameter __D0 PBKillIOAsync(__A0)
  766. #endif
  767. extern pascal OSErr PBKillIOAsync(ParmBlkPtr paramBlock)
  768.  ONEWORDINLINE(0xA406);
  769.  
  770.  
  771. #if !GENERATINGCFM
  772. #pragma parameter __D0 PBKillIOImmed(__A0)
  773. #endif
  774. extern pascal OSErr PBKillIOImmed(ParmBlkPtr paramBlock)
  775.  ONEWORDINLINE(0xA206);
  776.  
  777. #endif
  778. extern pascal short OpenDeskAcc(ConstStr255Param deskAccName)
  779.  ONEWORDINLINE(0xA9B6);
  780.  
  781. extern pascal void CloseDeskAcc(short refNum)
  782.  ONEWORDINLINE(0xA9B7);
  783.  
  784. #if CGLUESUPPORTED
  785. extern short opendeskacc(const char *deskAccName);
  786.  
  787. extern OSErr opendriver(const char *driverName, short *refNum);
  788.  
  789. #endif
  790. #if OLDROUTINENAMES
  791. /*
  792.     The PBxxx() routines are obsolete.  
  793.     
  794.     Use the PBxxxSync(), PBxxxAsync(), or PBxxxImmed version instead.
  795. */
  796. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  797. #define PBControl(pb, async) ((async) ? PBControlAsync(pb) : PBControlSync(pb))
  798. #define PBStatus(pb, async) ((async) ? PBStatusAsync(pb) : PBStatusSync(pb))
  799. #define PBKillIO(pb, async) ((async) ? PBKillIOAsync(pb) : PBKillIOSync(pb))
  800. #if !OLDROUTINELOCATIONS
  801. #define PBOpen(pb, async) ((async) ? PBOpenAsync(pb) : PBOpenSync(pb))
  802. #define PBClose(pb, async) ((async) ? PBCloseAsync(pb) : PBCloseSync(pb))
  803. #define PBRead(pb, async) ((async) ? PBReadAsync(pb) : PBReadSync(pb))
  804. #define PBWrite(pb, async) ((async) ? PBWriteAsync(pb) : PBWriteSync(pb))
  805. #endif
  806. #endif
  807. #endif
  808. #if FOR_SYSTEM8_PREEMPTIVE
  809. /*
  810. //////////////////////////////////////////////////////////////////////////////
  811.  System 8 Ndrv requests entry point drivers
  812. */
  813. extern OSStatus DoDeviceManagerIO(IOCommandID commandID, IOCommandContents contents, IOCommandCode code, IOCommandKind kind, KernelNotification *someTypeofNotification);
  814.  
  815. struct DeviceManagerIOIteratorData {
  816.     IOCommonInfo                     ioCI;
  817.     short                             pluginNumber;
  818.     short                             refNum;
  819.     DriverDescription                 desc;
  820. };
  821. typedef struct DeviceManagerIOIteratorData DeviceManagerIOIteratorData;
  822.  
  823. extern OSStatus DeviceManagerGetDeviceData(ItemCount requestItemCount, ItemCount *totalItemCount, DeviceManagerIOIteratorData **dataArray);
  824.  
  825. #endif
  826.  
  827. #if PRAGMA_ALIGN_SUPPORTED
  828. #pragma options align=reset
  829. #endif
  830.  
  831. #if PRAGMA_IMPORT_SUPPORTED
  832. #pragma import off
  833. #endif
  834.  
  835. #ifdef __cplusplus
  836. }
  837. #endif
  838.  
  839. #endif /* __DEVICES__ */
  840.  
  841.